package com.itheima01.day09;

import java.util.ArrayList;

/**
 * @author 刘全
 * @date 2021/7/10
 */
/*
需求：创建一个存储学生对象的集合，存储3个学生对象，使用程序实现在控制台遍历该集合
 */
public class ArraayList2 {
    public static void main(String[] args) {
        Long start = System.currentTimeMillis();
        ArrayList<Student> list = new ArrayList<>();
        Student stu1 = new Student("张三",23);
        Student stu2 = new Student("李四",24);
        Student stu3 = new Student("王五",25);
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        for (int i = 0; i < list.size(); i++) {
            Student stu = list.get(i);
            System.out.println(stu.getName()+","+stu.getAge());
        }
        Long end = System.currentTimeMillis();
        System.out.println(end - start);
    }
}
